// import { createSlice } from "@reduxjs/toolkit";

// let ShopSlice = createSlice({
// 	name: "ShopSlice",
// 	initialState: {
// 		Arr: JSON.parse(localStorage.getItem('Arr')) || [], //内存中取数据
// 	},
// 	reducers: {
// 		shopAdd(state, action) {
// 			let copy = [...state.Arr];
// 			let i = copy.findIndex((item) => item.id === action.payload.id); //action.payload为页面传递过来的数据
// 			if (i === -1) {
// 				copy.push(action.payload);
// 				state.Arr = [...copy];
// 			} else {
// 				copy[i].num++;
// 				state.Arr = [...copy];
// 			}
//             localStorage.setItem('Arr',JSON.stringify(state.Arr)) //存数据到缓存
// 			return state;
// 		},
// 	},
// });

// export let { shopAdd } = ShopSlice.actions; //方法抛出
// export default ShopSlice;  //切片抛出
